<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE>
<html>

<head lang="en">
    <meta charset="UTF-8">
    <title>有间花店 | 后台管理</title>
    <link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico">
    <link href="css/bootstrap.min.css" rel="stylesheet">

    <script src="js/html5shiv.js"></script>
    <script src="js/respond.min.js"></script>
    <!-- 引入css样式-->
    <link rel="stylesheet" type="text/css" href="css/admin.css"
          media="screen">
    <script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/admin.js"></script>

    <style type="text/css">
        a:focus, a:hover {
            text-decoration: none;
        }

        .panel-body {
            text-align: left;
        }

        textarea {
            resize: none;
        }

        form ul li label {
            font-size: 18px;
        }

        form ul li input {
            width: 300px;
            height: 40px;
        }

        #productBillSubmit {
            float: right;
            margin-top: 40px;
            padding: 6px 12px;
            font-size: 14px;
            font-weight: 400;
            background-color: #dff0d8;
            line-height: 1.42857143;
            color: #333;
            cursor: pointer;
            border: 1px solid #ccc;
            border-radius: 4px;
        }
    </style>
</head>

<body>

<div class="wrap">
    <!-- 左边内容 -->
    <jsp:include page="/admin_menu.jsp"></jsp:include>


    <!-- 右边内容 -->
    <div id="right" class="tab-content right">

        <!-- 订单处理模块-->
        <div>
            <div id="sp_add">
                <div class="panel panel-info">
                    <div class="panel-heading">位置：订单处理</div>
                </div>
                <form id="sp_add_left" method="POST"
                      style="width: 100%; margin: 100px 250px;">
                    <div style="float: left;">

                        <ul>
                            <li><label>添加分类：</label>
                            <li><label><input type="text" id="cname"></label></li>

                        </ul>
                    </div>
                </form>
                <div style="position: absolute; top: 360px; left: 1000px;">
                    <button id="productBillSubmit"  type="button" onclick="tj()">提交</button>
                    <button id="btn_reset" type="reset" onclick="resetAll()">返回</button>
                </div>
            </div>

            <script type="text/javascript">
                function resetAll(){
                    location.href = "${pageContext.request.contextPath}/selectAllProduct.do?startPage=1";
                }

            </script>

        </div>
    </div>
</div>
<script>
function tj(){

        var cname=$("#cname").val();
        if (cname==null||cname==""){
            alert("不能为空");
            return false;
        }else {
            $.ajax({
                url:"/inserttb_category.do",
                data:{"cname":cname},
                type:"post",
                success:function (data) {
                    if (data=="OK") {
                        alert("添加成功");
                        $("#cname").val("");
                    }else {
                        alert("添加失败，该商品已存在");
                    }
                }

            })
        }


}

</script>
</body>

</html>